package com.example.design.c.command;

import lombok.Getter;

/**
 * 菜单
 */
@Getter
public enum FoodEnum {
    西红柿炒鸡蛋(1, "西红柿炒鸡蛋"),
    辣椒炒肉(2, "辣椒炒肉"),
    爆炒甘蓝(3, "爆炒甘蓝"),
    蚂蚁上树(4, "蚂蚁上树"),
    奥尔良鸡腿堡(5, "奥尔良鸡腿堡"),
    巧克力蛋糕(6, "巧克力蛋糕"),
    醋溜肥肠(7, "醋溜肥肠");

    /**
     * 菜品代号
     */
    private final int code;

    /**
     * 菜品名称
     */
    private final String foodName;

    FoodEnum(int foodNum, String foodName) {
        this.code = foodNum;
        this.foodName = foodName;
    }

    public static String foodName(int code) {
        FoodEnum[] foods = values();
        for (FoodEnum food : foods) {
            if (food.getCode() == code) {
                return food.getFoodName();
            }
        }
        return "未知菜品名称";
    }
}
